package com.itheima.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Collections;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class PageBeanVo implements Serializable {
    private Long total = 0L;//总记录数
    private Integer pageSize;//页大小
    private Long totalPage=0L;//总页数
    private Integer pageNum;//当前页码
    private List<?> list = Collections.emptyList(); //列表

    public PageBeanVo(Integer pageNum, Integer pageSize, Long total, List list) {
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.list = list;
        this.total = total;
        this.totalPage = total % pageSize == 0 ? (total / pageSize) : (total / pageSize) + 1;
    }






}
